#ifndef NETWORK_CONNECT_H
#define NETWORK_CONNECT_H

#include <httplib.h>
#include <string>
#include <functional>

class NetworkConnect
{
  public:
    NetworkConnect(std::string url);
    virtual ~NetworkConnect();
    long CreateTask(std::string name);
    bool CheckStuExist(long id);
    std::string GetStudentInf(long id);
    void StartShot(long task_id,long stu_id);
    void StopShot();
    bool CheckShotStatus();
  private:
    httplib::Client client;
    void GetHttpRequire(const std::string& path,std::function<void(httplib::Result&)> func);
    template<class T>
    T DecodeMsgPackOneData(const std::string&);
    template<class T>
    T autoRequireAndDecode(const std::string& path);
};

#endif
